import 'package:flutter_screenutil/screenutil.dart';
import 'package:flutter/material.dart';

class NavigationBar extends StatefulWidget {
  String title;
  bool isShowBack;
  final Function backCallback;
  final Function moreCallback;
  bool useback;
  NavigationBar(this.useback,{this.backCallback,this.moreCallback,this.title,this.isShowBack =true,Key key}):super(key:key);
  @override
  _NavigationBarState createState() => _NavigationBarState();
}

class _NavigationBarState extends State<NavigationBar> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color:Colors.white,
      width: ScreenUtil.screenWidth,
      height: ScreenUtil().setWidth(64),
      child:Row(
        children: [
          SizedBox(width: ScreenUtil().setWidth(15.7),),
          InkWell(
            onTap: (){
              if(widget.useback){
                widget.backCallback();
              }else {
                Navigator.pop(context);
              }
            },
            child:widget.isShowBack==false?Container():Container(
                width: ScreenUtil().setWidth(25),
                height: ScreenUtil().setWidth(25),
                child:Image.asset("sources/yy/back.png",width: ScreenUtil().setWidth(14.6),height: ScreenUtil().setWidth(14.6),fit: BoxFit.contain,),
                )
          ),
          SizedBox(width: ScreenUtil().setWidth(11.7),),
          Container(
            width: ScreenUtil().setWidth(80),
            child:Text(widget.title??"",style: TextStyle(fontSize: ScreenUtil().setSp(17),),textAlign: TextAlign.left,),
          ),
          SizedBox(width: ScreenUtil().setWidth(200),),
          InkWell(
              onTap: (){
                 widget.moreCallback();
              },
              child:Container(
                width: ScreenUtil().setWidth(25),
                height: ScreenUtil().setWidth(25),
                child:Image.asset("sources/yy/more.png",width: ScreenUtil().setWidth(14.6),height: ScreenUtil().setWidth(14.6),),
              )
          ),

        ],
      ),
    );
  }
}
